#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 20;
vector<int> a[N], d(N);
int m, n;
bool dfs(int x, int c) {
    d[x] = c;
    for (auto &j: a[x]) {
        if (!d[j]) {
            if(!dfs(j, -c)) return false;
        }
        else if(d[j] == d[x]) return false;
    }
    return true;
}
int main() {
    cin >> m >> n;
    d.resize(m);
    while (n--) {
        int c, b;
        scanf("%d%d", &c, &b);
        a[c].push_back(b);
        a[b].push_back(c);
    }
    for (int i = 1; i <= m; i++) {
        if (!d[i]) {
            if (!dfs(i, 1)) {
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");
    return 0;
}
